FROM ubuntu:22.10
ENV DEBIAN_FRONTEND noninteractive
ENV DOCKER 1

RUN <<EOF bash 
    apt-get update 
    apt-get upgrade -y
    apt install -y software-properties-common apt-transport-https wget
    apt install -y --no-install-recommends cron python3 pip
    wget -q https://packages.microsoft.com/keys/microsoft.asc -O- | apt-key add -
    add-apt-repository "deb [arch=amd64] https://packages.microsoft.com/repos/edge stable main"
    apt update && apt install -y microsoft-edge-dev
EOF

RUN <<EOF bash 
    python3 -m pip install aiosqlite aiologger pyppeteer
EOF

RUN <<EOF bash
    apt autoremove -y &&
    rm -rf /var/cache/apt /var/lib/apt/lists
EOF

RUN useradd scraped -m

WORKDIR /home/scraped
COPY cronjob.txt main.py bp.sh .
RUN chmod +x bp.sh
RUN cat cronjob.txt | crontab

CMD ["cron", "-f"]
